In imaging systems, image sharpness can vary with departures from the best focus position. As such, the best focus position of imaging systems is often determined by moving the position of the object relative to the imaging system until the sharpest image is formed. Typically, image contrast is used as a measure of sharpness to identify the best focus position at the peak contrast.
U.S. Pat. No. 7,812,971, which is assigned in common with this application, features an autofocus system for a machine vision system that scans along an optical axis collecting a plurality of image frames at a plurality of different wavelengths to determine the positions of maximum contrast for each wavelength. The maximum contrast measurements can be combined based on the expected displacements among the wavelengths to determine a position of best focus. Alternatively, contrast measurements for the different wavelengths at a single axis position can be fit to the contrast value plots of the different wavelengths over a range of axis positions for identifying the best focus position.
In optical systems with large depths of field, e.g., having a large f-number, the variations in sharpness in the vicinity of the best focus position tend to be more gradual, which reduces the accuracy and precision with which the best focus position can be found. Departures from the best focus positions can often be tolerated for optical systems with large f-numbers because the variation in sharpness is so gradual. However, in such systems that are arranged to switch between magnifications, the departure from best focus workable at a lower magnification can be beyond the depth of field at a higher magnification, leaving no measurable image from which a further focus adjustment can be made. Making separate focus adjustments between low and high magnification imaging can be time consuming and add variability between the measurements.
Measures of contrast, which often involve pixel-to-pixel intensity comparisons, differ from the usual measures for which the measuring machines are designed and require additional processing algorithms and other capabilities. Unless the object subject to imaging is matched to a given choice of algorithm, the efficacy of the contrast measurement can vary considerably. Thus, inconsistent focusing results can be associated with a range of different objects that are the subject of the intended measurement.